package main.java.factory;

public class CoffeeStore {
    public Coffee orderCoffee(String type) {
        Coffee coffee = null;
        switch (type) {
            case "american":
                coffee = new AmericanCoffee();
                break;
            case "latte":
                coffee = new LatteCoffee();
                break;
            default:
                throw new RuntimeException("没有此类咖啡");
        }
        if (coffee != null) {
            coffee.addMilk();
            coffee.addSugar();
        }

        return coffee;
    }
}
